package org.dtrd.modules.control.entity.bean;

import cn.hutool.core.util.StrUtil;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import org.dtrd.config.system.Constant;
import org.dtrd.config.system.Constant.TargetProject;
import org.dtrd.modules.control.entity.po.DtrdEntRdSigninTarget;
import org.dtrd.modules.control.entity.po.DtrdEntRdSigninTargetDetail;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Date;
import java.util.List;

@ApiModel("控制目标和详情数据对象")
@Getter
@Setter
public class TargetAndDetailInfo {

    @NotNull
    @Min(value = 1)
    @ApiModelProperty("患者id")
    private Integer patientId;

    @ApiModelProperty("控制目标的id")
    private Integer targetId;

    @NotBlank
    @ApiModelProperty("控制目标名称")
    private String targetName;

    @ApiModelProperty("创建时间")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private Date createTime;

    @ApiModelProperty("开始时间")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private Date startDate;

    @ApiModelProperty("结束时间")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private Date endDate;

    @ApiModelProperty("体质指数（BMI）")
    private Float bmi;
    @ApiModelProperty("bmi实际值")
    private Float bmiValue;
    @ApiModelProperty("bmi状态, 0-相等, 1-上升, 2-下降")
    private Integer bmiStatus = 0;

    @ApiModelProperty("糖化血红蛋白（HbA1c）")
    private Float hbA1c;
    @ApiModelProperty("糖化实际值")
    private Float hbA1cValue;
    @ApiModelProperty("糖化状态, 0-相等, 1-上升, 2-下降")
    private Integer hbA1cStatus = 1;

    @ApiModelProperty("空腹血糖（FBG）")
    private Float fbg;
    @ApiModelProperty("fbg实际值")
    private Float fbgValue;
    @ApiModelProperty("fbg状态, 0-相等, 1-上升, 2-下降")
    private Integer fbgStatus = 2;

    @ApiModelProperty("餐后血糖（PBG）")
    private Float pbg;
    @ApiModelProperty("餐后血糖实际值")
    private Float pbgValue;
    @ApiModelProperty("pbg状态, 0-相等, 1-上升, 2-下降")
    private Integer pbgStatus = 0;

    @ApiModelProperty("舒张压/低压")
    private Float pressureLow;
    @ApiModelProperty("舒张压/低压实际值")
    private Float pressureLowValue;
    @ApiModelProperty("舒张压/低压状态, 0-相等, 1-上升, 2-下降")
    private Integer pressureLowStatus = 1;

    @ApiModelProperty("收缩压/高压")
    private Float pressureHigh;
    @ApiModelProperty("收缩压/高压实际值")
    private Float pressureHighValue;
    @ApiModelProperty("收缩压/高压状态, 0-相等, 1-上升, 2-下降")
    private Integer pressureHighStatus = 2;

    @ApiModelProperty("总胆固醇（TC）")
    private Float tc;
    @ApiModelProperty("tc实际值")
    private Float tcValue;
    @ApiModelProperty("tc状态, 0-相等, 1-上升, 2-下降")
    private Integer tcStatus = 0;

    @ApiModelProperty("甘油三酯（TG）")
    private Float tg;
    @ApiModelProperty("甘油三酯（TG）实际值")
    private Float tgValue;
    @ApiModelProperty("tg状态, 0-相等, 1-上升, 2-下降")
    private Integer tgStatus = 1;

    @ApiModelProperty("高密度脂蛋白（HDL）")
    private Float hdl;
    @ApiModelProperty("高密度脂蛋白（HDL）实际值")
    private Float hdlValue;
    @ApiModelProperty("hdl状态, 0-相等, 1-上升, 2-下降")
    private Integer hdlStatus = 2;

    @ApiModelProperty("低密度脂蛋白（LDL）")
    private Float ldl;
    @ApiModelProperty("低密度脂蛋白（LDL）实际值")
    private Float ldlValue;
    @ApiModelProperty("ldl状态, 0-相等, 1-上升, 2-下降")
    private Integer ldlStatus = 0;

    @ApiModelProperty("腰围")
    private Float waist;
    @ApiModelProperty("腰围实际值")
    private Float waistValue;
    @ApiModelProperty("腰围状态, 0-相等, 1-上升, 2-下降")
    private Integer waistStatus = 1;

    @ApiModelProperty("心率")
    private Float heartRate;
    @ApiModelProperty("心率实际值")
    private Float heartRateValue;
    @ApiModelProperty("心率状态, 0-相等, 1-上升, 2-下降")
    private Integer heartRateStatus = 2;

    @ApiModelProperty("体重")
    private Float weight;
    @ApiModelProperty("体重实际值")
    private Float weightValue;
    @ApiModelProperty("体重状态, 0-相等, 1-上升, 2-下降")
    private Integer weightStatus = 0;

    @ApiModelProperty("用药")
    private String drug;
    @ApiModelProperty("用药实际值")
    private String drugValue = "不用药";

    @ApiModelProperty("达标值")
    private String reachStandardRate = "39%";

    @ApiModelProperty("谷丙转氨酶（ALT）")
    private Float alt;
    @ApiModelProperty("ALT实际值")
    private Float altValue;
    @ApiModelProperty("ALT状态, 0-相等, 1-上升, 2-下降")
    private Integer altStatus = 0;

    @ApiModelProperty("总胆红素（T-BIL）")
    private Float bil;
    @ApiModelProperty("T-BIL实际值")
    private Float bilValue;
    @ApiModelProperty("T-BIL状态, 0-相等, 1-上升, 2-下降")
    private Integer bilStatus = 0;

    @ApiModelProperty("谷草转氨酶（AST）")
    private Float ast;
    @ApiModelProperty("AST实际值")
    private Float astValue;
    @ApiModelProperty("AST状态, 0-相等, 1-上升, 2-下降")
    private Integer astStatus = 0;

    @ApiModelProperty("碱性磷酸酶（ALP）")
    private Float alp;
    @ApiModelProperty("ALP实际值")
    private Float alpValue;
    @ApiModelProperty("ALP状态, 0-相等, 1-上升, 2-下降")
    private Integer alpStatus = 0;

    @ApiModelProperty("尿微量白蛋白（UAE）")
    private Float uae;
    @ApiModelProperty("UAE实际值")
    private Float uaeValue;
    @ApiModelProperty("ALP状态, 0-相等, 1-上升, 2-下降")
    private Integer uaeStatus = 0;

    @ApiModelProperty("24h尿白蛋白（24hUAE）")
    private Float uae_24h;
    @ApiModelProperty("UAE实际值")
    private Float uae_24hValue;
    @ApiModelProperty("ALP状态, 0-相等, 1-上升, 2-下降")
    private Integer uae_24hStatus = 0;

    @ApiModelProperty("尿白蛋白/尿肌酐（ACR）")
    private Float acr;
    @ApiModelProperty("ACR实际值")
    private Float acrValue;
    @ApiModelProperty("ACR状态, 0-相等, 1-上升, 2-下降")
    private Integer acrStatus = 0;

    @ApiModelProperty("血清肌酐（Cr）")
    private Float cr;
    @ApiModelProperty("CR实际值")
    private Float crValue;
    @ApiModelProperty("CR状态, 0-相等, 1-上升, 2-下降")
    private Integer crStatus = 0;

    @ApiModelProperty("尿素氮")
    private Float ureanitrogen;
    @ApiModelProperty("尿素氮实际值")
    private Float ureanitrogenValue;
    @ApiModelProperty("尿素氮状态, 0-相等, 1-上升, 2-下降")
    private Integer ureanitrogenStatus = 0;

    @ApiModelProperty("肾小球滤过率（GFR）")
    private Float gfr;
    @ApiModelProperty("GFR实际值")
    private Float gfrValue;
    @ApiModelProperty("GFR状态, 0-相等, 1-上升, 2-下降")
    private Integer gfrStatus = 0;

    @ApiModelProperty("内生肌酐清除率")
    private Float crcl;
    @ApiModelProperty("CrCl实际值")
    private Float crclValue;
    @ApiModelProperty("crcl状态, 0-相等, 1-上升, 2-下降")
    private Integer crclStatus = 0;

    @ApiModelProperty("血尿酸")
    private Float bua;
    @ApiModelProperty("血尿酸实际值")
    private Float buaValue;
    @ApiModelProperty("血尿酸状态, 0-相等, 1-上升, 2-下降")
    private Integer buaStatus = 0;

    public TargetAndDetailInfo parseFromPo(DtrdEntRdSigninTarget po) {
        targetId = po.getDataId();
        startDate = po.getStartDate();
        endDate = po.getEndDate();
        createTime = po.getCreateTime();
        targetName = po.getTargetName();
        patientId = po.getPatientId();
        return this;
    }

    public TargetAndDetailInfo parseFromPo(List<DtrdEntRdSigninTargetDetail> poList) {
        for (DtrdEntRdSigninTargetDetail detail : poList) {
            Constant.TargetProject targetDetail = Constant.TargetProject.valueOf(detail.getProjectType());
            assert targetDetail != null;
            switch (targetDetail) {
                case BMI:
                    bmi = detail.getTargetLow();
                    bmiValue = detail.getValue();
                    break;
                case TC:
                    tc = detail.getTargetLow();
                    tcValue = detail.getValue();
                    break;
                case TG:
                    tg = detail.getTargetLow();
                    tgValue = detail.getValue();
                    break;
                case FBG:
                    fbg = detail.getTargetLow();
                    fbgValue = detail.getValue();
                    break;
                case PBG:
                    pbg = detail.getTargetLow();
                    pbgValue = detail.getValue();
                    break;
                case LDL:
                    ldl = detail.getTargetLow();
                    ldlValue = detail.getValue();
                    break;
                case HDL:
                    hdl = detail.getTargetLow();
                    hdlValue = detail.getValue();
                    break;
                case WAIST:
                    waist = detail.getTargetLow();
                    waistValue = detail.getValue();
                    break;
                case HEART_RATE:
                    heartRate = detail.getTargetLow();
                    heartRateValue = detail.getValue();
                    break;
                case PRESSURE_LOW:
                    pressureLow = detail.getTargetLow();
                    pressureLowValue = detail.getValue();
                    break;
                case PRESSURE_HIGH:
                    pressureHigh = detail.getTargetLow();
                    pressureHighValue = detail.getValue();
                    break;
                case HBA1C:
                    hbA1c = detail.getTargetLow();
                    hbA1cValue = detail.getValue();
                    break;
                case WEIGHT:
                    weight = detail.getTargetLow();
                    weightValue = detail.getValue();
                    break;
                case DRUG:
                    drug = detail.getRemark();
                    drugValue = detail.getRemark();
                    break;
                case BIL:
                    bil = detail.getTargetLow();
                    bilValue = detail.getValue();
                    break;
                case AST:
                    ast = detail.getTargetLow();
                    astValue = detail.getValue();
                    break;
                case ALP:
                    alp = detail.getTargetLow();
                    alpValue = detail.getValue();
                    break;
                case UAE:
                    uae = detail.getTargetLow();
                    uaeValue = detail.getValue();
                    break;
                case UAE_24H:
                    uae_24h = detail.getTargetLow();
                    uae_24hValue = detail.getValue();
                    break;
                case ACR:
                    acr = detail.getTargetLow();
                    acrValue = detail.getValue();
                    break;
                case Cr:
                    cr = detail.getTargetLow();
                    crValue = detail.getValue();
                    break;
                case UREANITROGEN:
                    ureanitrogen = detail.getTargetLow();
                    ureanitrogenValue = detail.getValue();
                    break;
                case GFR:
                    gfr = detail.getTargetLow();
                    gfrValue = detail.getValue();
                    break;
                case CrCl:
                    crcl = detail.getTargetLow();
                    crclValue = detail.getValue();
                    break;
                case ALT:
                    alt = detail.getTargetLow();
                    altValue = detail.getValue();
                case BUA:
                    bua = detail.getTargetLow();
                    buaValue = detail.getValue();
                default:
                    break;
            }
        }
        return this;
    }

    public List<DtrdEntRdSigninTargetDetail> toTargetDetailList() {
        List<DtrdEntRdSigninTargetDetail> list = new ArrayList<>(14);
        if (bmi != null) {
            list.add(generateTargetDetail(bmi, bmi, bmi, TargetProject.BMI.getType()));
        }
        if (weight != null) {
            list.add(generateTargetDetail(weight, weight, weight, TargetProject.WEIGHT.getType()));
        }
        if (waist != null) {
            list.add(generateTargetDetail(waist, waist, waist, TargetProject.WAIST.getType()));
        }
        if (hbA1c != null) {
            list.add(generateTargetDetail(hbA1c, hbA1c, hbA1c, Constant.TargetProject.HBA1C.getType()));
        }
        if (fbg != null) {
            list.add(generateTargetDetail(fbg, fbg, fbg, TargetProject.FBG.getType()));
        }
        if (pbg != null) {
            list.add(generateTargetDetail(pbg, pbg, pbg, TargetProject.PBG.getType()));
        }
        if (pressureLow != null) {
            list.add(generateTargetDetail(pressureLow, pressureLow, pressureLow, TargetProject.PRESSURE_LOW.getType()));
        }
        if (pressureHigh != null) {
            list.add(generateTargetDetail(pressureHigh, pressureHigh, pressureHigh, TargetProject.PRESSURE_HIGH.getType()));
        }
        if (heartRate != null) {
            list.add(generateTargetDetail(heartRate, heartRate, heartRate, TargetProject.HEART_RATE.getType()));
        }
        if (tc != null) {
            list.add(generateTargetDetail(tc, tc, tc, Constant.TargetProject.TC.getType()));
        }
        if (tg != null) {
            list.add(generateTargetDetail(tg, tg, tg, Constant.TargetProject.TG.getType()));
        }
        if (ldl != null) {
            list.add(generateTargetDetail(ldl, ldl, ldl, Constant.TargetProject.LDL.getType()));
        }
        if (hdl != null) {
            list.add(generateTargetDetail(hdl, hdl, hdl, Constant.TargetProject.HDL.getType()));
        }
        if (bil != null) {
            list.add(generateTargetDetail(bil, bil, bil, TargetProject.BIL.getType()));
        }
        if (ast != null) {
            list.add(generateTargetDetail(ast, ast, ast, TargetProject.AST.getType()));
        }
        if (alp != null) {
            list.add(generateTargetDetail(alp, alp, alp, TargetProject.ALP.getType()));
        }
        if (uae != null) {
            list.add(generateTargetDetail(uae, uae, uae, TargetProject.UAE.getType()));
        }
        if (uae_24h != null) {
            list.add(generateTargetDetail(uae_24h, uae_24h, uae_24h, TargetProject.UAE_24H.getType()));
        }
        if (acr != null) {
            list.add(generateTargetDetail(acr, acr, acr, TargetProject.ACR.getType()));
        }
        if (cr != null) {
            list.add(generateTargetDetail(cr, cr, cr, TargetProject.Cr.getType()));
        }
        if (ureanitrogen != null) {
            list.add(generateTargetDetail(ureanitrogen, ureanitrogen, ureanitrogen, TargetProject.UREANITROGEN.getType()));
        }
        if (gfr != null) {
            list.add(generateTargetDetail(gfr, gfr, gfr, TargetProject.GFR.getType()));
        }
        if (crcl != null) {
            list.add(generateTargetDetail(crcl, crcl, crcl, TargetProject.CrCl.getType()));
        }
        if (alt != null) {
            list.add(generateTargetDetail(alt, alt, alt, TargetProject.ALT.getType()));
        }
        if (bua != null) {
            list.add(generateTargetDetail(bua, bua, bua, TargetProject.BUA.getType()));
        }
        if (StrUtil.isNotBlank(drug)) {
            DtrdEntRdSigninTargetDetail targetDetail = generateTargetDetail(null, null, null, TargetProject.DRUG.getType());
            targetDetail.setRemark(drug);
            list.add(targetDetail);
        }
        return list;
    }

    private DtrdEntRdSigninTargetDetail generateTargetDetail(Float targetLow, Float targetHigh, Float targetValue, Integer projectType) {
        DtrdEntRdSigninTargetDetail targetDetail = new DtrdEntRdSigninTargetDetail();
        targetDetail.setTargetLow(targetLow);
        targetDetail.setTargetHigh(targetHigh);
        targetDetail.setValue(targetValue);
        targetDetail.setProjectType(projectType);
        return targetDetail;
    }

    public static final class TargetAndDetailInfoBuilder {
        private TargetAndDetailInfo targetAndDetailInfo;

        private TargetAndDetailInfoBuilder() {
            targetAndDetailInfo = new TargetAndDetailInfo();
        }

        public static TargetAndDetailInfoBuilder aTargetAndDetailInfo() {
            return new TargetAndDetailInfoBuilder();
        }

        public TargetAndDetailInfoBuilder withPatientId(Integer patientId) {
            targetAndDetailInfo.setPatientId(patientId);
            return this;
        }

        public TargetAndDetailInfoBuilder withTargetId(Integer targetId) {
            targetAndDetailInfo.setTargetId(targetId);
            return this;
        }

        public TargetAndDetailInfoBuilder withTargetName(String targetName) {
            targetAndDetailInfo.setTargetName(targetName);
            return this;
        }

        public TargetAndDetailInfoBuilder withCreateTime(Date createTime) {
            targetAndDetailInfo.setCreateTime(createTime);
            return this;
        }

        public TargetAndDetailInfoBuilder withStartDate(Date startDate) {
            targetAndDetailInfo.setStartDate(startDate);
            return this;
        }

        public TargetAndDetailInfoBuilder withEndDate(Date endDate) {
            targetAndDetailInfo.setEndDate(endDate);
            return this;
        }

        public TargetAndDetailInfoBuilder withBmi(Float bmi) {
            targetAndDetailInfo.setBmi(bmi);
            return this;
        }

        public TargetAndDetailInfoBuilder withBmiValue(Float bmiValue) {
            targetAndDetailInfo.setBmiValue(bmiValue);
            return this;
        }

        public TargetAndDetailInfoBuilder withBmiStatus(Integer bmiStatus) {
            targetAndDetailInfo.setBmiStatus(bmiStatus);
            return this;
        }

        public TargetAndDetailInfoBuilder withHbA1c(Float hbA1c) {
            targetAndDetailInfo.setHbA1c(hbA1c);
            return this;
        }

        public TargetAndDetailInfoBuilder withHbA1cValue(Float hbA1cValue) {
            targetAndDetailInfo.setHbA1cValue(hbA1cValue);
            return this;
        }

        public TargetAndDetailInfoBuilder withHbA1cStatus(Integer hbA1cStatus) {
            targetAndDetailInfo.setHbA1cStatus(hbA1cStatus);
            return this;
        }

        public TargetAndDetailInfoBuilder withFbg(Float fbg) {
            targetAndDetailInfo.setFbg(fbg);
            return this;
        }

        public TargetAndDetailInfoBuilder withFbgValue(Float fbgValue) {
            targetAndDetailInfo.setFbgValue(fbgValue);
            return this;
        }

        public TargetAndDetailInfoBuilder withFbgStatus(Integer fbgStatus) {
            targetAndDetailInfo.setFbgStatus(fbgStatus);
            return this;
        }

        public TargetAndDetailInfoBuilder withPbg(Float pbg) {
            targetAndDetailInfo.setPbg(pbg);
            return this;
        }

        public TargetAndDetailInfoBuilder withPbgValue(Float pbgValue) {
            targetAndDetailInfo.setPbgValue(pbgValue);
            return this;
        }

        public TargetAndDetailInfoBuilder withPbgStatus(Integer pbgStatus) {
            targetAndDetailInfo.setPbgStatus(pbgStatus);
            return this;
        }

        public TargetAndDetailInfoBuilder withPressureLow(Float pressureLow) {
            targetAndDetailInfo.setPressureLow(pressureLow);
            return this;
        }

        public TargetAndDetailInfoBuilder withPressureLowValue(Float pressureLowValue) {
            targetAndDetailInfo.setPressureLowValue(pressureLowValue);
            return this;
        }

        public TargetAndDetailInfoBuilder withPressureLowStatus(Integer pressureLowStatus) {
            targetAndDetailInfo.setPressureLowStatus(pressureLowStatus);
            return this;
        }

        public TargetAndDetailInfoBuilder withPressureHigh(Float pressureHigh) {
            targetAndDetailInfo.setPressureHigh(pressureHigh);
            return this;
        }

        public TargetAndDetailInfoBuilder withPressureHighValue(Float pressureHighValue) {
            targetAndDetailInfo.setPressureHighValue(pressureHighValue);
            return this;
        }

        public TargetAndDetailInfoBuilder withPressureHighStatus(Integer pressureHighStatus) {
            targetAndDetailInfo.setPressureHighStatus(pressureHighStatus);
            return this;
        }

        public TargetAndDetailInfoBuilder withTc(Float tc) {
            targetAndDetailInfo.setTc(tc);
            return this;
        }

        public TargetAndDetailInfoBuilder withTcValue(Float tcValue) {
            targetAndDetailInfo.setTcValue(tcValue);
            return this;
        }

        public TargetAndDetailInfoBuilder withTcStatus(Integer tcStatus) {
            targetAndDetailInfo.setTcStatus(tcStatus);
            return this;
        }

        public TargetAndDetailInfoBuilder withTg(Float tg) {
            targetAndDetailInfo.setTg(tg);
            return this;
        }

        public TargetAndDetailInfoBuilder withTgValue(Float tgValue) {
            targetAndDetailInfo.setTgValue(tgValue);
            return this;
        }

        public TargetAndDetailInfoBuilder withTgStatus(Integer tgStatus) {
            targetAndDetailInfo.setTgStatus(tgStatus);
            return this;
        }

        public TargetAndDetailInfoBuilder withHdl(Float hdl) {
            targetAndDetailInfo.setHdl(hdl);
            return this;
        }

        public TargetAndDetailInfoBuilder withHdlValue(Float hdlValue) {
            targetAndDetailInfo.setHdlValue(hdlValue);
            return this;
        }

        public TargetAndDetailInfoBuilder withHdlStatus(Integer hdlStatus) {
            targetAndDetailInfo.setHdlStatus(hdlStatus);
            return this;
        }

        public TargetAndDetailInfoBuilder withLdl(Float ldl) {
            targetAndDetailInfo.setLdl(ldl);
            return this;
        }

        public TargetAndDetailInfoBuilder withLdlValue(Float ldlValue) {
            targetAndDetailInfo.setLdlValue(ldlValue);
            return this;
        }

        public TargetAndDetailInfoBuilder withLdlStatus(Integer ldlStatus) {
            targetAndDetailInfo.setLdlStatus(ldlStatus);
            return this;
        }

        public TargetAndDetailInfoBuilder withWaist(Float waist) {
            targetAndDetailInfo.setWaist(waist);
            return this;
        }

        public TargetAndDetailInfoBuilder withWaistValue(Float waistValue) {
            targetAndDetailInfo.setWaistValue(waistValue);
            return this;
        }

        public TargetAndDetailInfoBuilder withWaistStatus(Integer waistStatus) {
            targetAndDetailInfo.setWaistStatus(waistStatus);
            return this;
        }

        public TargetAndDetailInfoBuilder withHeartRate(Float heartRate) {
            targetAndDetailInfo.setHeartRate(heartRate);
            return this;
        }

        public TargetAndDetailInfoBuilder withHeartRateValue(Float heartRateValue) {
            targetAndDetailInfo.setHeartRateValue(heartRateValue);
            return this;
        }

        public TargetAndDetailInfoBuilder withHeartRateStatus(Integer heartRateStatus) {
            targetAndDetailInfo.setHeartRateStatus(heartRateStatus);
            return this;
        }

        public TargetAndDetailInfoBuilder withWeight(Float weight) {
            targetAndDetailInfo.setWeight(weight);
            return this;
        }

        public TargetAndDetailInfoBuilder withWeightValue(Float weightValue) {
            targetAndDetailInfo.setWeightValue(weightValue);
            return this;
        }

        public TargetAndDetailInfoBuilder withWeightStatus(Integer weightStatus) {
            targetAndDetailInfo.setWeightStatus(weightStatus);
            return this;
        }

        public TargetAndDetailInfoBuilder withDrug(String drug) {
            targetAndDetailInfo.setDrug(drug);
            return this;
        }

        public TargetAndDetailInfoBuilder withDrugValue(String drugValue) {
            targetAndDetailInfo.setDrugValue(drugValue);
            return this;
        }

        public TargetAndDetailInfoBuilder withBil(Float bil) {
            targetAndDetailInfo.setBil(bil);
            return this;
        }

        public TargetAndDetailInfoBuilder withBilValue(Float bilValue) {
            targetAndDetailInfo.setBilValue(bilValue);
            return this;
        }

        public TargetAndDetailInfoBuilder withBilStatus(Integer bilStatus) {
            targetAndDetailInfo.setBilStatus(bilStatus);
            return this;
        }

        public TargetAndDetailInfoBuilder withAst(Float ast) {
            targetAndDetailInfo.setAst(ast);
            return this;
        }

        public TargetAndDetailInfoBuilder withAstValue(Float astValue) {
            targetAndDetailInfo.setAstValue(astValue);
            return this;
        }

        public TargetAndDetailInfoBuilder withAstStatus(Integer astStatus) {
            targetAndDetailInfo.setAstStatus(astStatus);
            return this;
        }

        public TargetAndDetailInfoBuilder withAlp(Float alp) {
            targetAndDetailInfo.setAlp(alp);
            return this;
        }

        public TargetAndDetailInfoBuilder withAlpValue(Float alpValue) {
            targetAndDetailInfo.setAlpValue(alpValue);
            return this;
        }

        public TargetAndDetailInfoBuilder withAlpStatus(Integer alpStatus) {
            targetAndDetailInfo.setAlpStatus(alpStatus);
            return this;
        }

        public TargetAndDetailInfoBuilder withUae(Float uae) {
            targetAndDetailInfo.setUae(uae);
            return this;
        }

        public TargetAndDetailInfoBuilder withUaeValue(Float uaeValue) {
            targetAndDetailInfo.setUaeValue(uaeValue);
            return this;
        }

        public TargetAndDetailInfoBuilder withUaeStatus(Integer uaeStatus) {
            targetAndDetailInfo.setUaeStatus(uaeStatus);
            return this;
        }

        public TargetAndDetailInfoBuilder withUae_24h(Float uae_24h) {
            targetAndDetailInfo.setUae_24h(uae_24h);
            return this;
        }

        public TargetAndDetailInfoBuilder withUae_24hValue(Float uae_24hValue) {
            targetAndDetailInfo.setUae_24hValue(uae_24hValue);
            return this;
        }

        public TargetAndDetailInfoBuilder withUae_24hStatus(Integer uae_24hStatus) {
            targetAndDetailInfo.setUae_24hStatus(uae_24hStatus);
            return this;
        }

        public TargetAndDetailInfoBuilder withAcr(Float acr) {
            targetAndDetailInfo.setAcr(acr);
            return this;
        }

        public TargetAndDetailInfoBuilder withAcrValue(Float acrValue) {
            targetAndDetailInfo.setAcrValue(acrValue);
            return this;
        }

        public TargetAndDetailInfoBuilder withAcrStatus(Integer acrStatus) {
            targetAndDetailInfo.setAcrStatus(acrStatus);
            return this;
        }

        public TargetAndDetailInfoBuilder withCr(Float cr) {
            targetAndDetailInfo.setCr(cr);
            return this;
        }

        public TargetAndDetailInfoBuilder withCrValue(Float crValue) {
            targetAndDetailInfo.setCrValue(crValue);
            return this;
        }

        public TargetAndDetailInfoBuilder withCrStatus(Integer crStatus) {
            targetAndDetailInfo.setCrStatus(crStatus);
            return this;
        }

        public TargetAndDetailInfoBuilder withUreanitrogen(Float ureanitrogen) {
            targetAndDetailInfo.setUreanitrogen(ureanitrogen);
            return this;
        }

        public TargetAndDetailInfoBuilder withUreanitrogenValue(Float ureanitrogenValue) {
            targetAndDetailInfo.setUreanitrogenValue(ureanitrogenValue);
            return this;
        }

        public TargetAndDetailInfoBuilder withUreanitrogenStatus(Integer ureanitrogenStatus) {
            targetAndDetailInfo.setUreanitrogenStatus(ureanitrogenStatus);
            return this;
        }

        public TargetAndDetailInfoBuilder withGfr(Float gfr) {
            targetAndDetailInfo.setGfr(gfr);
            return this;
        }

        public TargetAndDetailInfoBuilder withGfrValue(Float gfrValue) {
            targetAndDetailInfo.setGfrValue(gfrValue);
            return this;
        }

        public TargetAndDetailInfoBuilder withGfrStatus(Integer gfrStatus) {
            targetAndDetailInfo.setGfrStatus(gfrStatus);
            return this;
        }

        public TargetAndDetailInfoBuilder withCrCl(Float crCl) {
            targetAndDetailInfo.setCrcl(crCl);
            return this;
        }

        public TargetAndDetailInfoBuilder withCrClValue(Float crClValue) {
            targetAndDetailInfo.setCrclValue(crClValue);
            return this;
        }

        public TargetAndDetailInfoBuilder withCrClStatus(Integer crClStatus) {
            targetAndDetailInfo.setCrStatus(crClStatus);
            return this;
        }

        public TargetAndDetailInfoBuilder withAlt(Float alt) {
            targetAndDetailInfo.setAlt(alt);
            return this;
        }

        public TargetAndDetailInfoBuilder withAltValue(Float altValue) {
            targetAndDetailInfo.setAltValue(altValue);
            return this;
        }

        public TargetAndDetailInfoBuilder withAltStatus(Integer altStatus) {
            targetAndDetailInfo.setAltStatus(altStatus);
            return this;
        }

        public TargetAndDetailInfoBuilder withBua(Float alt) {
            targetAndDetailInfo.setBua(alt);
            return this;
        }

        public TargetAndDetailInfoBuilder withBuaValue(Float buaValue) {
            targetAndDetailInfo.setBuaValue(buaValue);
            return this;
        }

        public TargetAndDetailInfoBuilder withBuaStatus(Integer buaStatus) {
            targetAndDetailInfo.setBuaStatus(buaStatus);
            return this;
        }

        public TargetAndDetailInfo build() {
            return targetAndDetailInfo;
        }
    }
}
